/***************************************************
> Copyright (C) 2024 ==KINGYI== All rights reserved.
> File Name: 1.c
> Author:cjy
> Mail: 
> Created Time: 2024年08月02日 星期五 10时33分22秒
***************************************************/

#include <stdio.h>
#include <string.h>
#include <mysql/mysql.h>
#include <stdlib.h>
int main(int argc,const char* argv[])
{
    char sql[100] = {0};
	MYSQL *res = NULL;
	MYSQL *con = NULL;
	con = mysql_init(NULL);
	res = mysql_real_connect(con,"localhost","root","123","cjy",0,NULL,0);
	if(res == NULL){
		printf("%s\n",mysql_error(con));
		exit(-1);
	}
	int ret = 0;
	int id = 0;
	printf("请输入想要删除学员id:");
	scanf("%d",&id);
    sprintf(sql,"delete from student where code=%d",id);
	ret = mysql_query(con,sql);
	if(ret != 0){
		printf("%s\n",mysql_error(con));
		mysql_close(con);
		exit(-1);
	}
	mysql_close(con);
    return 0;
}
